export function initSlots(instance,children) {
    normalizeObjectSlots(children,instance.slots)
}

export function normalizeObjectSlots(children,slots) {
    for (const key in children) {
        let val = children[key]
        slots[key] = (props) => normalizeSlotValue(val(props))  
    }
}

function normalizeSlotValue(val) {
    return Array.isArray(val) ? val : [val]  
}

// 原先的(一个意思,上边的封装过的,语义化更加明确)
// export function initSlots(instance,children) {
//     let slots = {}
//     for (const key in children) {
//         let val = children[key]
//         slots[key] = Array.isArray(val) ? val : [val]  
//     }
//     instance.slots = slots
// }
